﻿#ifndef _BASE_STREAM_VIDEO_
#define _BASE_STREAM_VIDEO_

#include "xcast_handler.h"
#include <string>
namespace Stream {
namespace Video {
namespace Listener {
class Interface {
public:
  virtual ~Interface() {}

  virtual void OnUpVideoStream(const char* stream_id, bool add) = 0;

  virtual void OnDownVideoStream(const char* stream_id, uint64_t uin, bool add) = 0;
  
  virtual void OnVideoStreamUpdate(const char* stream_id, uint64_t uin, int state) = 0;

  virtual void OnVideoStreamFrame(uint64_t uin, uint8_t* data, uint32_t data_size, int32_t format, uint32_t width, uint32_t height, uint32_t rotate, const char* stream) { }

  virtual void OnVideoStreamLayer(
    uint32_t layer_index, uint32_t layer_size, uint8_t* layer_data, uint32_t layer_format, uint32_t layer_blend_mode,
    double layer_left, double layer_top, uint32_t layer_width, uint32_t layer_height, uint32_t layer_container_width, uint32_t layer_container_height,
    uint64_t layer_uin, bool layer_visible, const char* layer_stream) { }
};

void Add(Interface* listener);

void Remove(Interface* listener);
}

  namespace XcastEvent {
  void OnAdd(const char* stream_id, bool up, uint64_t uin, bool add);
  void OnUpdate(const char* stream_id, uint64_t uin, int state);
  void OnVideoFrame(uint64_t uin, uint8_t* data, uint32_t data_size, int32_t format, uint32_t width, uint32_t height, uint32_t rotate, const char* stream);
  void OnVideoLayer(
    uint32_t layer_index, uint32_t layer_size, uint8_t* layer_data, uint32_t layer_format, uint32_t layer_blend_mode,
    double layer_left, double layer_top, uint32_t layer_width, uint32_t layer_height, uint32_t layer_container_width, uint32_t layer_container_height,
    uint64_t layer_uin, bool layer_visible, const char* layer_stream);
  }

  int Start(const char* stream_id, bool enable);
  int Request(const char* stream_id, bool enable, bool is_small);
  int GetState(const char* stream_id);
  std::string GetStream(const char* uid, int stream_type);
  int SwitchSource(const char* device_id);
}
}

#endif
